package com.spudtech.collision
{
    
    import flash.geom.*;
    
    import com.spudtech.*;
    
    
    public class SpudQuadTree
    {
        
        protected var _depth : uint;
        
        protected var _lowestCellWidth : uint;
        protected var _lowestCellHeight : uint;
        
        protected var _areaWidth : uint;
        protected var _areaHeight : uint;
        
        
        public function SpudQuadTree(area_width : uint,
                                     area_height : uint,
                                     init_depth : uint = 4,
                                     lowest_cell_width : uint = 20,
                                     lowest_cell_height : uint = 20)
        {
            _areaWidth = area_width;
            _areaHeight = area_height;
            
            _depth = init_depth;
            
            _lowestCellWidth = lowest_cell_width;
            _lowestCellHeight = lowest_cell_height;
            
        }
        
        public function getCellAt(position : Point, cell_depth : uint) : SpudRect
        {
            // TODO
            
            if (cell_depth > _depth)
            {
                throw new RangeError("Requested cell is deeper than tree");
            }
            
            return null;
            
        }
        
    }
    
}
